#pragma once
#include <galois/cont/TypeCheck.h>
#include <galois/cont/ArrayHandle.h>
#include <iostream>
using galois::cont::ArrayHandle;

namespace galois
{
namespace worklet
{
template <typename WorkletType>
class Dispatcher
{
public:
  Dispatcher(const WorkletType& worklet = WorkletType{})
    : _worklet(worklet)
  {
  }

  void DoInvoke(const ArrayHandle<int>& array) const { 
      
      std::cout << "Dispatcher::DoInvoke\n"; 
      for (size_t i = 0; i < array.Length(); i++)
      {
         _worklet(array[i]);
      }
  
  }

  void operator()() const {}

  WorkletType _worklet;
};

}
}